package com.itheima.mall.mapper;


import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.mall.pojo.SkuStock;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface SkuStockMapper  extends BaseMapper<SkuStock>  {


    @Update({"<script>" +
            "<foreach collection=\"skuStockList\" item=\"item\" separator=\";\">" +
            " UPDATE" +
            " pms_sku_stock" +
            " WHERE" +
            " pid = #{item.pid}" +
            "</foreach>" +
            "</script>"})
    void updateSkuStocksByPid(@Param("pid") Integer pid, @Param("skuStockList") List<SkuStock> skuStockList);
}
